﻿namespace MEF_Test
{
    using System;
    using System.Collections.Generic;
    using System.Windows;

    using MEF_Test.Contracts;

    /// <summary>
    /// The view model for the browser detail panel
    /// </summary>
    internal class BrowserDetailViewModel : IBrowserDetailViewModel
    {
        #region Constructors and Destructors

        /// <summary>
        /// Initializes a new instance of the <see cref="BrowserDetailViewModel"/> class.
        /// </summary>
        /// <param name="fileHandler">The file handler.</param>
        /// <param name="mediaHandler">The media handler.</param>
        /// <param name="supportedActions">The supported actions.</param>
        /// <param name="detailDataTemplate">The detail data template.</param>
        public BrowserDetailViewModel(IFileHandler fileHandler, IMediaHandler mediaHandler, IEnumerable<INodeAction> supportedActions, DataTemplate detailDataTemplate)
        {
            FileHandler = fileHandler;
            MediaHandler = mediaHandler;
            SupportedActions = supportedActions;
            DetailDataTemplate = detailDataTemplate;
            if (fileHandler == null)
            {
                throw new ArgumentNullException("fileHandler");
            }

            if (mediaHandler == null)
            {
                throw new ArgumentNullException("mediaHandler");
            }

            if (supportedActions == null)
            {
                throw new ArgumentNullException("supportedActions");
            }

            if (detailDataTemplate == null)
            {
                throw new ArgumentNullException("detailDataTemplate");
            }
        }

        #endregion

        #region Properties

        /// <summary>
        /// Gets the detail data template.
        /// </summary>
        /// <value>The detail data template.</value>
        public DataTemplate DetailDataTemplate { get; private set; }

        /// <summary>
        /// Gets the file handler.
        /// </summary>
        /// <value>The file handler.</value>
        public IFileHandler FileHandler { get; private set; }

        /// <summary>
        /// Gets the media handler.
        /// </summary>
        /// <value>The media handler.</value>
        public IMediaHandler MediaHandler { get; private set; }

        /// <summary>
        /// Gets the supported actions.
        /// </summary>
        /// <value>The supported actions.</value>
        public IEnumerable<INodeAction> SupportedActions { get; private set; }

        #endregion
    }
}